package com.tanhua.server.controller;

import com.tanhua.model.vo.UserSoundVo;
import com.tanhua.server.service.PeachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @Description: test
 * @Create by: 熊孩子
 * @Date: 2021/12/11 11:36
 */
@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {

    @Autowired
    private PeachblossomService peachblossomService;

    //发送语音 POST/peachblossom
    @PostMapping
    public ResponseEntity sendPeachblossom(MultipartFile soundFile) throws IOException {

        peachblossomService.sendPeachblossom(soundFile);
        return ResponseEntity.ok(null);
    }
    //接收语音 GET/peachblossom
    @GetMapping
    public ResponseEntity receivePeachblossom(){
        UserSoundVo vo = peachblossomService.receivePeachblossom();
        return ResponseEntity.ok(vo);
    }
}
